load("//tools/bzl:java.bzl", "java_library2")

java_library(
    name = "lib",
    testonly = 1,
    resource_strip_prefix = "resources",
    resources = ["//resources/com/google/gerrit/acceptance"],
    visibility = ["//visibility:public"],
    exports = [
        ":framework-lib",
        "//java/com/google/gerrit/common:annotations",
        "//java/com/google/gerrit/common:server",
        "//java/com/google/gerrit/extensions:api",
        "//java/com/google/gerrit/extensions/common/testing:common-test-util",
        "//java/com/google/gerrit/extensions/restapi/testing:restapi-test-util",
        "//java/com/google/gerrit/gpg/testing:gpg-test-util",
        "//java/com/google/gerrit/httpd",
        "//java/com/google/gerrit/index",
        "//java/com/google/gerrit/launcher",
        "//java/com/google/gerrit/lucene",
        "//java/com/google/gerrit/metrics",
        "//java/com/google/gerrit/pgm",
        "//java/com/google/gerrit/pgm/init",
        "//java/com/google/gerrit/pgm/util",
        "//java/com/google/gerrit/reviewdb:server",
        "//java/com/google/gerrit/server",
        "//java/com/google/gerrit/server/git/receive",
        "//java/com/google/gerrit/server/project/testing:project-test-util",
        "//java/com/google/gerrit/server/restapi",
        "//java/com/google/gerrit/sshd",
        "//java/com/google/gerrit/testing:gerrit-test-util",
        "//lib:args4j",
        "//lib:gson",
        "//lib:guava-retrying",
        "//lib:gwtjsonrpc",
        "//lib:gwtorm",
        "//lib:h2",
        "//lib:jimfs",
        "//lib:jsch",
        "//lib:servlet-api-3_1-without-neverlink",
        "//lib/bouncycastle:bcpg",
        "//lib/bouncycastle:bcprov",
        "//lib/commons:compress",
        "//lib/guice",
        "//lib/guice:guice-assistedinject",
        "//lib/guice:guice-servlet",
        "//lib/jgit/org.eclipse.jgit:jgit",
        "//lib/log:api",
        "//lib/mina:sshd",
        "//prolog:gerrit-prolog-common",
    ],
)

java_binary(
    name = "framework",
    testonly = 1,
    main_class = "Dummy",
    visibility = ["//visibility:public"],
    runtime_deps = [":framework-lib"],
)

java_library2(
    name = "framework-lib",
    testonly = 1,
    srcs = glob(["**/*.java"]),
    exported_deps = [
        "//java/com/google/gerrit/gpg",
        "//java/com/google/gerrit/httpd/auth/openid",
        "//java/com/google/gerrit/index:query_exception",
        "//java/com/google/gerrit/launcher",
        "//java/com/google/gerrit/lifecycle",
        "//java/com/google/gerrit/pgm:daemon",
        "//java/com/google/gerrit/pgm/http/jetty",
        "//java/com/google/gerrit/pgm/util",
        "//java/com/google/gerrit/server/project/testing:project-test-util",
        "//java/com/google/gerrit/testing:gerrit-test-util",
        "//lib:jimfs",
        "//lib:truth",
        "//lib:truth-java8-extension",
        "//lib/auto:auto-value",
        "//lib/httpcomponents:fluent-hc",
        "//lib/httpcomponents:httpclient",
        "//lib/httpcomponents:httpcore",
        "//lib/jetty:servlet",
        "//lib/jgit/org.eclipse.jgit.junit:junit",
        "//lib/log:impl_log4j",
        "//lib/log:log4j",
        "//prolog:gerrit-prolog-common",
    ],
    visibility = ["//visibility:public"],
    deps = [
        "//java/com/google/gerrit/common:annotations",
        "//java/com/google/gerrit/common:server",
        "//java/com/google/gerrit/extensions:api",
        "//java/com/google/gerrit/httpd",
        "//java/com/google/gerrit/index",
        "//java/com/google/gerrit/lucene",
        "//java/com/google/gerrit/metrics",
        "//java/com/google/gerrit/pgm/init",
        "//java/com/google/gerrit/reviewdb:server",
        "//java/com/google/gerrit/server",
        "//java/com/google/gerrit/server/git/receive",
        "//java/com/google/gerrit/server/restapi",
        "//java/com/google/gerrit/server/schema",
        "//lib:gson",
        "//lib:guava-retrying",
        "//lib:gwtorm",
        "//lib:jsch",
        "//lib:servlet-api-3_1",
        "//lib/greenmail",
        "//lib/guice",
        "//lib/guice:guice-assistedinject",
        "//lib/guice:guice-servlet",
        "//lib/jgit/org.eclipse.jgit:jgit",
        "//lib/mail",
        "//lib/mina:sshd",
    ],
)

load("//tools/bzl:javadoc.bzl", "java_doc")

java_doc(
    name = "framework-javadoc",
    testonly = 1,
    libs = [":framework-lib"],
    pkgs = ["com.google.gerrit.acceptance"],
    title = "Gerrit Acceptance Test Framework Documentation",
    visibility = ["//visibility:public"],
)
